home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / libg_261.zip / libg_261 / libg++ / gperf / tests / test.c < prev   
C/C++ Source or Header  |  1991-06-28  |  540b  |  27 lines

  1. /*
  2.    Tests the generated perfect has function.
  3.    The -v option prints diagnostics as to whether a word is in 
  4.    the set or not.  Without -v the program is useful for timing.
  5. */ 
  6.   
  7. #include <stdio.h>
  8.  
  9. #define MAX_LEN 80
  10.  
  11. int 
  12. main (argc, argv) 
  13.      int   argc;
  14.      char *argv[];
  15. {
  16.   int  verbose = argc > 1 ? 1 : 0;
  17.   char buf[MAX_LEN];
  18.  
  19.   while (gets (buf)) 
  20.     if (in_word_set (buf, strlen (buf)) && verbose) 
  21.       printf ("in word set %s\n", buf);
  22.     else if (verbose) 
  23.       printf ("NOT in word set %s\n", buf);
  24.  
  25.   return 0;
  26. }
  27.